package com.hmkj.core.constant;

import com.hmkj.core.exception.BussinessException;
import com.xiaoleilu.hutool.date.DateUtil;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 系统参数常量  类型1,系统底层配置:bottom;2,费率信息配置:fees;3,邮件/短信配置:notice;4,三方接口配置:third;5,附加功能配置:other
 *
 * @author Mr.
 * @date 2017/5/22
 */
public interface ConfigNID {

    /******************************** 1 系统底层配置 ***********************************/
    /** 网站名称 */
    String WEB_TITLE = CacheID.CONFIG_PREFIX + "web_title";
    /** 网站备案号 */
    String COPY_RIGHT = CacheID.CONFIG_PREFIX + "copy_right";
    /** 前台服务地址 */
    String WEB_SERVER_URL = CacheID.CONFIG_PREFIX + "web_server_url";
    /** 文件服务器地址 */
    String IMAGE_SEVER_URL = CacheID.CONFIG_PREFIX + "image_server_url";
    /** 后台服务器地址 */
    String ADMIN_SEVER_URL = CacheID.CONFIG_PREFIX + "admin_server_url";
    /** 静态资源地址 */
    String STATIC_SERVER_URL = CacheID.CONFIG_PREFIX + "static_server_url";
    /** 充值未处理超时过期时间 */
    String RECHARGE_EXPIRED = CacheID.CONFIG_PREFIX + "recharge_expired";
    /** 支付同步回调地址 */
    String PAY_RETURN_URL = CacheID.CONFIG_PREFIX + "pay_return_url";
    /** 是否开通万能验证码 9999 */
    String SUPER_VALIDATE_OPEN = CacheID.CONFIG_PREFIX + "super_validate_open";
    /** 初始模拟账户金额*/
    String ACCOUNT_SIM_AMOUNT =  CacheID.CONFIG_PREFIX + "account_sim_amount";
    /** 支付宝账号*/
    String 	ALIPAY_ACCOUNT =  CacheID.CONFIG_PREFIX + "alipay_account";
    /** 支付宝姓名*/
    String 	ALIPAY_NAME =  CacheID.CONFIG_PREFIX + "alipay_name";
    /** 支付宝收款地址*/
    String 	ALIPAY_URL =  CacheID.CONFIG_PREFIX + "alipay_url";
    /** 默认推广佣金 */
    String 	REWARD_SCALES_DEFAULT =  CacheID.CONFIG_PREFIX + "reward_scales_default";
    /** 系统标识，用于区分不同系统之间的成交推送 */
    String 	SYS_FLAG =  CacheID.CONFIG_PREFIX + "sys_flag";

    /** OSS EndPoint */
    String 	OSS_ENDPOINT =  CacheID.CONFIG_PREFIX + "oss_endpoint";
    /** OSS accesskey_id */
    String 	OSS_ACCESSKEY_ID =  CacheID.CONFIG_PREFIX + "oss_accesskey_id";
    /** OSS oss_accesskey_secret */
    String 	OSS_ACCESSKEY_SECRET =  CacheID.CONFIG_PREFIX + "oss_accesskey_secret";
    /** OSS oss_bucket_name */
    String 	OSS_BUCKET_NAME =  CacheID.CONFIG_PREFIX + "oss_bucket_name";

    /** IOS审核版本开关 */
    String 	IOS_ISAUDIT =  CacheID.CONFIG_PREFIX + "ios_isaudit";



    /******************************** 2 费率信息配置 ***********************************/
    /** 充值单笔最低金额(元) */
    String RECHARGE_MIN = CacheID.CONFIG_PREFIX + "recharge_min";
    /** 充值单笔最高金额(元) */
    String RECHARGE_MAX = CacheID.CONFIG_PREFIX + "recharge_max";
    /** 提现单笔最低金额(元) */
    String CASH_MIN = CacheID.CONFIG_PREFIX + "cash_min";
    /** 提现单笔最高金额(元) */
    String CASH_MAX = CacheID.CONFIG_PREFIX + "cash_max";
    /** 提现手续费最小值(元) */
    String CASH_FEE_MIN = CacheID.CONFIG_PREFIX + "cash_fee_min";
    /** 提现手续费率% */
    String CASH_FEE_RATIO = CacheID.CONFIG_PREFIX + "cash_fee_ratio";
    /** 提现是否需要后台审核 */
    String CASH_NEED_AUDIT = CacheID.CONFIG_PREFIX + "cash_need_audit";
    /**提现平台承担手续费比例(%)*/
    String CASH_FEE_PERCENT = CacheID.CONFIG_PREFIX + "cash_fee_percent";
    /**提现单日累计次数*/
    String CASH_DAILY_COUNT = CacheID.CONFIG_PREFIX + "cash_daily_count";
    /**提现单日累计总额(元)*/
    String CASH_DAILY_AMOUNT = CacheID.CONFIG_PREFIX + "cash_daily_amount";



    /******************************** 3 邮件/短信配置 ***********************************/
    /** 是否开通短信功能 */
    String SMS_OPEN = CacheID.CONFIG_PREFIX + "sms_open";
    /** 短信验证码有效期（单位：分钟） */
    String VERIFY_CODE_TIME = CacheID.CONFIG_PREFIX + "verify_code_time";
    /** 平台验证码签名 */
    String SMS_SIGN = CacheID.CONFIG_PREFIX + "sms_sign";
    /** 邮箱smtp地址 */
    String EMAIL_SMTP_ADDRESS = CacheID.CONFIG_PREFIX + "email_smtp_address";
    /** 邮箱发件人邮箱 */
    String EMAIL_ACCOUNT = CacheID.CONFIG_PREFIX + "email_account";
    /** 邮箱发件人邮箱密码 */
    String EMAIL_ACCOUNT_PWD = CacheID.CONFIG_PREFIX + "email_account_pwd";
    /** 邮箱发件人邮箱名称 */
    String EMAIL_ACCOUNT_NAME = CacheID.CONFIG_PREFIX + "email_account_name";
    /** 短信 创蓝 用户名 */
    String SMS_CL_USERNAME = CacheID.CONFIG_PREFIX + "sms_cl_username";
    /** 短信 创蓝 密码 */
    String SMS_CL_PWD = CacheID.CONFIG_PREFIX + "sms_cl_pwd";
    /** 短信 创蓝 地址 */
    String SMS_CL_URL = CacheID.CONFIG_PREFIX + "sms_cl_url";

    /** 短信 助通 用户名 */
    String SMS_ZT_USERNAME = CacheID.CONFIG_PREFIX + "sms_zt_username";
    /** 短信 助通 密码 */
    String SMS_ZT_PWD = CacheID.CONFIG_PREFIX + "sms_zt_pwd";
    /** 短信 助通 地址 */
    String SMS_ZT_URL = CacheID.CONFIG_PREFIX + "sms_zt_url";



    /******************************** 4 三方接口配置 ***********************************/


    /******************************** 5 附加功能配置 ***********************************/
    /** 最大跟单手数 */
    String FOLLOW_HAND_MAX = CacheID.CONFIG_PREFIX + "follow_hand_max";
    /** 跟单手数 */
    String FOLLOW_HAND_NUM = CacheID.CONFIG_PREFIX + "follow_hand_num";
    /** 模拟交易奖励积分次数 */
    String REWARD_COUNT_SIMU = CacheID.CONFIG_PREFIX + "reward_count_simu";
    /** 实盘交易奖励积分次数 */
    String REWARD_COUNT = CacheID.CONFIG_PREFIX + "reward_count";
    /** 恒指委托价偏移量 */
    String OFFSET_HSI = CacheID.CONFIG_PREFIX + "offset_hsi";
    /** 小恒指委托价偏移量 */
    String OFFSET_MHI = CacheID.CONFIG_PREFIX + "offset_mhi";
    /** 德指委托价偏移量 */
    String OFFSET_DAX = CacheID.CONFIG_PREFIX + "offset_dax";


    /** 交易 API 客户编号 */
    String API_SENDER = CacheID.CONFIG_PREFIX + "api_sender";
    /** 交易 API 外盘期货机构编号 */
    String API_ORG_OTC = CacheID.CONFIG_PREFIX + "api_org_otc";
    /** 交易 API 内盘期货机构编号 */
    String API_ORG_NATIVE = CacheID.CONFIG_PREFIX + "api_org_native";

    public static void main(String[] args1) {
        try {
            SimpleDateFormat f1 = new SimpleDateFormat("yyyy-MM-dd");
            SimpleDateFormat f2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date now = f2.parse("2017-12-19 11:50:40");

            String value = "09:15,12:00|13:00,16:25;17:15,23:40";

            String[] args = value.split(";");
            if (args.length == 1) {
                String[] times = args[0].split(",");
                Date autoCoverStart = f2.parse(f1.format(now) + " " + times[times.length - 1] + ":00");
                Date autoCoverEnd = DateUtil.offsetMinute(autoCoverStart,5);
                if (autoCoverStart.compareTo(now) <= 0 && autoCoverEnd.compareTo(now) >= 0) {
                    System.out.println(true);
                }
            } else if (args.length == 2) {
                String[] times1 = args[0].split(",");
                Date autoCoverStart1 = f2.parse(f1.format(now) + " " + times1[times1.length - 1] + ":00");
                Date autoCoverEnd1 = DateUtil.offsetMinute(autoCoverStart1,5);
                if (autoCoverStart1.compareTo(now) <= 0 && autoCoverEnd1.compareTo(now) >= 0) {
                    System.out.println(true);
                }

                String[] times2 = args[1].split(",");
                Date autoCoverStart2 = f2.parse(f1.format(now) + " " + times2[times2.length - 1] + ":00");
                Date autoCoverEnd2 = DateUtil.offsetMinute(autoCoverStart2,5);
                if (autoCoverStart2.compareTo(now) <= 0 && autoCoverEnd2.compareTo(now) >= 0) {
                    System.out.println(true);
                }
            }
            System.out.println(false);
        } catch (ParseException e) {
            e.printStackTrace();
            throw new BussinessException("系统繁忙，请稍后再试");
        }
    }

}
